
module.exports = class DataService{
	constructor(request){
        this.request = request
    }

    async post(url,param){
        const result = await this.request({
            method:'post',
            url:'/openapi/form/dataService/'+url,
            data: param
        })
        return result
    }

    async insert(param){
        const {data} = await this.post('insert',param)
        return data
    }

    async batchInsert(param){
        const { data } = await this.post('batchInsert',param)
        return data
    }

    async batchUpdate(param){
        const { data } = await this.post('batchUpdate',param)
        return data
    }

    async update(param){
        const { data } = await this.post('update',param)
        return data
    }
x
    async batchUpdateByGroupConditions(param){
        const { data } = await this.post('batchUpdateByGroupConditions',param)
        return data
    }

    async deleteById(param){
        const { data } = await this.post('deleteById',param)
        return data
    }
    async deleteByIds(param){
        const { data } = await this.post('deleteByIds',param)
        return data
    }
    async selectById(param){
        const { data } = await this.post('selectById',param)
        return data
    }
    async selectByIds(param){
        const { data:{list} } = await this.post('selectByIds',param)
        return list
    }
    async select(param){
        const { data } = await this.post('select',param)
        if(param.needPageInfo == true){
            return data
        }
        return data?.list
    }
    async selectMultipleTable(param){
        const { data } = await this.post('selectMultipleTable',param)
        if(param.needPageInfo == true){
            return data
        }
        return data?.list
    }
    async createFileByTemplate(param){
        const { data } = await this.post('createFileByTemplate',param)
        return data
    }
    async callFunction(param){
        const { data } = await this.post('callFunction',param)
        return data
    }
}